package com.tianlan.blog.entity;

import java.util.ArrayList;
import java.util.List;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EntityListeners;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Transient;

import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;

import io.swagger.annotations.ApiModel;

@ApiModel(value = "District对象", description = "")
@Entity
@Table(name ="sys_district")
@EntityListeners(AuditingEntityListener.class)
@DynamicInsert
@DynamicUpdate( value = true)
public class SysDistrict{

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Integer id;

    @Column(name = "name")
    private String name;

    @Column(name = "parent_id")
    private Integer parentId;

    @Column(name = "initial")
    private String initial;

    @Column(name = "initials")
    private String initials;

    @Column(name = "pinyin")
    private String pinyin;

    @Column(name = "suffix")
    private String suffix;

    @Column(name = "code")
    private String code;

    @Column(name = "order")
    private Integer order;

    @Transient
    private List<SysDistrict> children = new ArrayList<SysDistrict>();
    
	public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Integer getParentId() {
        return parentId;
    }

    public void setParentId(Integer parentId) {
        this.parentId = parentId;
    }

    public String getInitial() {
        return initial;
    }

    public void setInitial(String initial) {
        this.initial = initial;
    }

    public String getInitials() {
        return initials;
    }

    public void setInitials(String initials) {
        this.initials = initials;
    }

    public String getPinyin() {
        return pinyin;
    }

    public void setPinyin(String pinyin) {
        this.pinyin = pinyin;
    }

    public String getSuffix() {
        return suffix;
    }

    public void setSuffix(String suffix) {
        this.suffix = suffix;
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public Integer getOrder() {
        return order;
    }

    public void setOrder(Integer order) {
        this.order = order;
    }

    public List<SysDistrict> getChildren() {
        return children;
    }

    public void setChildren(List<SysDistrict> children) {
        this.children = children;
    }

    @Override
    public String toString() {
        return "District{" + "id=" + id + ", name=" + name + ", parentId=" + parentId + ", initial=" + initial
                + ", initials=" + initials + ", pinyin=" + pinyin + ", suffix=" + suffix + ", code=" + code + ", order="
                + order + "}";
    }
}
